import "url-search-params-polyfill";
import { _api, addAPIProvider, disableCache, enableCache } from "./iconify";
import axios from "axios";

if(!window.isInited){
  window.isInited = false;
}

const resources = ["https://icon2.quanyou.com.cn"];
const initQupIcon = () => {
  if (window.isInited) return;
  window.isInited = true;
  const request = axios.create();
  request.interceptors.response.use(res => {
    res.json = () => res.data;
    return res;
  });
  _api.setFetch(request.get);

  addAPIProvider("", {
    resources
  });

  disableCache("local"); // @Enum all | local | session
  enableCache("session");
};

initQupIcon();
